Micron Document
<!DOCTYPE html>
<html class="client-nojs vector-feature-night-mode-disabled vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-sticky-header-enabled" lang="en" dir="ltr"><head>
<meta charset="UTF-8">
<title>Automatic variable</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="canonical" href="https://en.wikipedia.org/wiki/Automatic_variable"> <link href="./mw/ext.cite.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/ext.pygments.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.icons.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/user.styles.css" rel="stylesheet" type="text/css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" type="text/css" href="./mw/site.styles.css">
<link rel="stylesheet" type="text/css" href="./mw/noscript.css">
<link rel="stylesheet" type="text/css" href="./footer.css">
<link rel="stylesheet" type="text/css" href="./vector-2022.css">
</head>
<body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Automatic_variable rootpage-Automatic_variable skin-vector-2022 action-view">
<div class="mw-page-container">
<div class="mw-page-container-inner">
<div class="mw-content-container">
<main id="content" class="mw-body">
<header class="mw-body-header vector-page-titlebar">
<h1 id="firstHeading" class="firstHeading mw-first-heading">
<span id="openzim-page-title" class="mw-page-title-main"><span class="mw-page-title-main">Automatic variable</span></span>
</h1>
</header>
<a id="top"></a>
<div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
<div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="en" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr">
<style data-mw-deduplicate="TemplateStyles:r1236090951">
/* start https://en.wikipedia.org/ */


.mw-parser-output .hatnote{font-style:italic}.mw-parser-output div.hatnote{padding-left:1.6em;margin-bottom:0.5em}.mw-parser-output .hatnote i{font-style:normal}.mw-parser-output .hatnote+link+.hatnote{margin-top:-0.5em}@media print{body.ns-0 .mw-parser-output .hatnote{display:none!important}}


/* end https://en.wikipedia.org/ */
</style><div role="note" class="hatnote navigation-not-searchable">This article is about Automatic variables. For the C++ keyword <code class="mw-highlight mw-highlight-lang-cpp mw-content-ltr" dir="ltr"><span class="k">auto</span></code> used for <a href="Type_inference" title="Type inference">type inference</a>, see <a href="C%2B%2B11#Type_inference" title="C++11">C++11 §&nbsp;Type inference</a>.</div>
<p>In <a href="Computer_programming" title="Computer programming">computer programming</a>, an <b>automatic variable</b> is a local <a href="Variable_(programming)" class="mw-redirect" title="Variable (programming)">variable</a> which is allocated and deallocated automatically when program flow enters and leaves the variable's scope. The <a href="Scope_(computer_science)" title="Scope (computer science)">scope</a> is the lexical context, particularly the function or block in which a variable is defined. Local data is typically (in most languages) invisible outside the function or lexical context where it is defined. Local data is also invisible and inaccessible to a <i>called</i> function,<sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span class="cite-bracket">[</span>note 1<span class="cite-bracket">]</span></a></sup> but is not deallocated, coming back in scope as the <a href="Execution_thread" class="mw-redirect" title="Execution thread">execution thread</a> returns to the caller.
</p><p>Automatic local variables primarily applies to <a href="Recursion_(computer_science)" title="Recursion (computer science)"> recursive</a> <a href="Scope_(programming)" class="mw-redirect" title="Scope (programming)">lexically-scoped</a> languages.<sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">[</span>note 2<span class="cite-bracket">]</span></a></sup> Automatic local variables are normally <a href="Stack-based_memory_allocation" title="Stack-based memory allocation">allocated in the stack frame</a> of the procedure in which they are declared.<sup id="cite_ref-3" class="reference"><a href="#cite_note-3"><span class="cite-bracket">[</span>note 3<span class="cite-bracket">]</span></a></sup> This was originally done to achieve <a href="Reentrant_(subroutine)" class="mw-redirect" title="Reentrant (subroutine)">re-entrancy</a> and allowing <a href="Recursion" title="Recursion">recursion</a>,<sup id="cite_ref-4" class="reference"><a href="#cite_note-4"><span class="cite-bracket">[</span>note 4<span class="cite-bracket">]</span></a></sup> a consideration that still applies today. The concept of automatic variables in recursive (and <a href="Nested_function" title="Nested function">nested</a>) functions in a lexically scoped language was introduced to the wider audience with <a href="ALGOL" title="ALGOL">ALGOL</a> in the late 1950s, and further popularized by its many descendants.
</p><p>The term <i><a href="Local_variable" title="Local variable">local variable</a></i> is usually synonymous with automatic variable, since these are the same thing in many programming languages, but local is more general – most local variables are automatic local variables, but <a href="Static_local_variable" class="mw-redirect" title="Static local variable">static local variables</a> also exist, notably in C. For a static local variable, the allocation is static (the lifetime is the entire program execution), not automatic, but it is only in scope during the execution of the function.
</p>
<meta property="mw:PageProp/toc">
<div class="mw-heading mw-heading2"><h2 id="In_specific_programming_languages">In specific programming languages</h2></div>
<div class="mw-heading mw-heading3"><h3 id="C,_C++">C, C++</h3></div>
<div role="note" class="hatnote navigation-not-searchable">See also: <a href="C_syntax#Storage_class_specifiers" title="C syntax">C syntax §&nbsp;Storage class specifiers</a></div>
<p>(Called <i>automatic</i> variables.)
</p><p>All variables declared within a <a href="Block_(programming)" title="Block (programming)">block</a> of code are automatic by default. An uninitialized automatic variable has an <a href="Undefined_behavior" title="Undefined behavior">undefined</a> value until it is assigned a valid value of its type. <sup id="cite_ref-5" class="reference"><a href="#cite_note-5"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup> The storage-class specifier <code>auto</code> can be added to these variable declarations as well, but as they are all automatic by default, this is entirely redundant and rarely done.
</p><p>In C, using the storage class <code>register</code> is a hint to the compiler to cache the variable in a processor register. Other than not allowing the address-of operator (<code>&amp;</code>) to be used on the variable or any of its subcomponents, the compiler is free to ignore the hint.<sup id="cite_ref-6" class="reference"><a href="#cite_note-6"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup>
</p><p>In <a href="C%2B%2B" title="C++">C++</a>, the constructor of automatic variables is called when the execution reaches the place of declaration. The destructor is called when it reaches the end of the given program block (program blocks are surrounded by curly brackets). This feature is often used to manage resource allocation and deallocation, like opening and then automatically closing files or freeing up memory, called <a href="Resource_Acquisition_Is_Initialization" class="mw-redirect" title="Resource Acquisition Is Initialization">Resource Acquisition Is Initialization</a> (RAII).
</p><p>Since C++11, C++ allows variables to be declared with the <code>auto</code> type specifier,<sup id="cite_ref-7" class="reference"><a href="#cite_note-7"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup> but this means that the variable's type is <a href="Type_inference" title="Type inference">inferred</a>, and does not refer to the scope of the variable.
</p>
<div class="mw-heading mw-heading3"><h3 id="Java">Java</h3></div>
<p>(Called <i>local variables</i>.)
</p><p>Similar to C and C++, but there is no <code>auto</code> or <code>register</code> keyword. However, the Java compiler will not allow the usage of a not-explicitly-initialized local variable and will give a compilation error (unlike C and C++ where the compiler will usually only give a warning). The Java standard demands that every local variable must be explicitly initialized before being used.<sup id="cite_ref-8" class="reference"><a href="#cite_note-8"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup> This differs from instance variables, which are implicitly initialized with default values (which are <samp style="padding-left:0.4em; padding-right:0.4em; color:var( --color-subtle, #666666);">0</samp> for numbers and <samp style="padding-left:0.4em; padding-right:0.4em; color:var( --color-subtle, #666666);">null</samp> for objects).
</p>
<div class="mw-heading mw-heading3"><h3 id="Perl">Perl</h3></div>
<p>(Called <i>lexical</i>, <i>my</i> or <i>private</i> variables.)
</p><p>In Perl, local variables are declared using the <code>my</code> operator. Uninitialized scalars will have the value <code>undef</code>; uninitialized arrays or hashes will be <code>()</code>.<sup id="cite_ref-9" class="reference"><a href="#cite_note-9"><span class="cite-bracket">[</span>5<span class="cite-bracket">]</span></a></sup>
</p><p>Perl also has a <code><a href="Local_variable" title="Local variable">local</a></code> operator that does not create automatic variables,<sup id="cite_ref-10" class="reference"><a href="#cite_note-10"><span class="cite-bracket">[</span>6<span class="cite-bracket">]</span></a></sup> instead giving global (package) variables a temporary value, which is <a href="Scope_(computer_science)#Dynamic_scoping" title="Scope (computer science)">dynamically scoped</a> to the enclosing block. When the scope of the variable is left, the old value is restored.
</p>
<div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2></div>
<ul><li><a href="C_syntax#Storage_class_specifiers" title="C syntax">C syntax#Storage class specifiers</a></li>
<li><a href="Variable-length_array" title="Variable-length array">Variable-length array</a> (<a href="C99" title="C99">C99</a> new feature)</li>
<li><a href="Call_stack" title="Call stack">Call stack</a></li>
<li><a href="Object_lifetime" title="Object lifetime">Object lifetime</a></li></ul>
<div class="mw-heading mw-heading2"><h2 id="Notes">Notes</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1239543626">
/* start https://en.wikipedia.org/ */


.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}


/* end https://en.wikipedia.org/ */
</style><div class="reflist">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><b><a href="#cite_ref-1">^</a></b></span> <span class="reference-text">unless it is a <a href="Nested_function" title="Nested function">nested function</a>, which itself is <i>defined</i> along that local data</span>
</li>
<li id="cite_note-2"><span class="mw-cite-backlink"><b><a href="#cite_ref-2">^</a></b></span> <span class="reference-text">although they exist in a somewhat similar, but not identical, form also in recursive languages with <a href="Dynamic_scoping" class="mw-redirect" title="Dynamic scoping">dynamic scoping</a>, such as older variants of <a href="LISP" class="mw-redirect" title="LISP">LISP</a></span>
</li>
<li id="cite_note-3"><span class="mw-cite-backlink"><b><a href="#cite_ref-3">^</a></b></span> <span class="reference-text">unless otherwise specified, such as static or heap-based data, which are specifiable in some languages</span>
</li>
<li id="cite_note-4"><span class="mw-cite-backlink"><b><a href="#cite_ref-4">^</a></b></span> <span class="reference-text">When the reentrant property of the routine is used, for recursion or otherwise, the <a href="Compiler_optimization" class="mw-redirect" title="Compiler optimization">optimizer</a> must <i>not</i> try to allocate such variables in <a href="Processor_register" title="Processor register">processor registers</a> (for efficiency) as this would break the reentrancy.</span>
</li>
</ol></div></div>
<div class="mw-heading mw-heading2"><h2 id="References">References</h2></div>
<div class="reflist">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-5"><span class="mw-cite-backlink"><b><a href="#cite_ref-5">^</a></b></span> <span class="reference-text">Current <style data-mw-deduplicate="TemplateStyles:r1238218222">
/* start https://en.wikipedia.org/ */


.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("./mw/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("./mw/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("./mw/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("./mw/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}


/* end https://en.wikipedia.org/ */
</style><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1256.pdf">"C standard"</a> <span class="cs1-format">(PDF)</span>.</cite>&nbsp;<span style="font-size: 85%;">(3.61&nbsp;<a href="Mebibyte" class="mw-redirect" title="Mebibyte">MiB</a>)</span>: section 6.2.4, Storage durations of objects</span>
</li>
<li id="cite_note-6"><span class="mw-cite-backlink"><b><a href="#cite_ref-6">^</a></b></span> <span class="reference-text"><cite class="citation cs2"><a rel="nofollow" class="external text" href="https://en.cppreference.com/w/c/language/storage_duration">"Storage Duration"</a>, <i>cppreference.com</i></cite></span>
</li>
<li id="cite_note-7"><span class="mw-cite-backlink"><b><a href="#cite_ref-7">^</a></b></span> <span class="reference-text"><cite class="citation cs2"><a rel="nofollow" class="external text" href="http://en.cppreference.com/w/cpp/language/auto">"Placeholder type specifiers"</a>, <i>cppreference.com</i></cite></span>
</li>
<li id="cite_note-8"><span class="mw-cite-backlink"><b><a href="#cite_ref-8">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.12.5">"4.12.5 Initial Values of Variables"</a>. Sun Microsystems<span class="reference-accessdate">. Retrieved <span class="nowrap">2008-10-17</span></span>.</cite></span>
</li>
<li id="cite_note-9"><span class="mw-cite-backlink"><b><a href="#cite_ref-9">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://perldoc.perl.org/perlsub.html#Private-Variables-via-my()">"Private variables via my() - perlsub - perldoc.perl.org"</a><span class="reference-accessdate">. Retrieved <span class="nowrap">2008-10-17</span></span>.</cite></span>
</li>
<li id="cite_note-10"><span class="mw-cite-backlink"><b><a href="#cite_ref-10">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://perldoc.perl.org/perlsub.html#Temporary-Values-via-local%28%29">"Temporary values via local() - perlsub - perldoc.perl.org"</a><span class="reference-accessdate">. Retrieved <span class="nowrap">2011-02-25</span></span>.</cite></span>
</li>
</ol></div></div>
<p><br>
</p>
<div class="navbox-styles"><style data-mw-deduplicate="TemplateStyles:r1129693374">
/* start https://en.wikipedia.org/ */


.mw-parser-output .hlist dl,.mw-parser-output .hlist ol,.mw-parser-output .hlist ul{margin:0;padding:0}.mw-parser-output .hlist dd,.mw-parser-output .hlist dt,.mw-parser-output .hlist li{margin:0;display:inline}.mw-parser-output .hlist.inline,.mw-parser-output .hlist.inline dl,.mw-parser-output .hlist.inline ol,.mw-parser-output .hlist.inline ul,.mw-parser-output .hlist dl dl,.mw-parser-output .hlist dl ol,.mw-parser-output .hlist dl ul,.mw-parser-output .hlist ol dl,.mw-parser-output .hlist ol ol,.mw-parser-output .hlist ol ul,.mw-parser-output .hlist ul dl,.mw-parser-output .hlist ul ol,.mw-parser-output .hlist ul ul{display:inline}.mw-parser-output .hlist .mw-empty-li{display:none}.mw-parser-output .hlist dt::after{content:": "}.mw-parser-output .hlist dd::after,.mw-parser-output .hlist li::after{content:" · ";font-weight:bold}.mw-parser-output .hlist dd:last-child::after,.mw-parser-output .hlist dt:last-child::after,.mw-parser-output .hlist li:last-child::after{content:none}.mw-parser-output .hlist dd dd:first-child::before,.mw-parser-output .hlist dd dt:first-child::before,.mw-parser-output .hlist dd li:first-child::before,.mw-parser-output .hlist dt dd:first-child::before,.mw-parser-output .hlist dt dt:first-child::before,.mw-parser-output .hlist dt li:first-child::before,.mw-parser-output .hlist li dd:first-child::before,.mw-parser-output .hlist li dt:first-child::before,.mw-parser-output .hlist li li:first-child::before{content:" (";font-weight:normal}.mw-parser-output .hlist dd dd:last-child::after,.mw-parser-output .hlist dd dt:last-child::after,.mw-parser-output .hlist dd li:last-child::after,.mw-parser-output .hlist dt dd:last-child::after,.mw-parser-output .hlist dt dt:last-child::after,.mw-parser-output .hlist dt li:last-child::after,.mw-parser-output .hlist li dd:last-child::after,.mw-parser-output .hlist li dt:last-child::after,.mw-parser-output .hlist li li:last-child::after{content:")";font-weight:normal}.mw-parser-output .hlist ol{counter-reset:listitem}.mw-parser-output .hlist ol>li{counter-increment:listitem}.mw-parser-output .hlist ol>li::before{content:" "counter(listitem)"\a0 "}.mw-parser-output .hlist dd ol>li:first-child::before,.mw-parser-output .hlist dt ol>li:first-child::before,.mw-parser-output .hlist li ol>li:first-child::before{content:" ("counter(listitem)"\a0 "}


/* end https://en.wikipedia.org/ */
</style><style data-mw-deduplicate="TemplateStyles:r1236075235">
/* start https://en.wikipedia.org/ */


.mw-parser-output .navbox{box-sizing:border-box;border:1px solid #a2a9b1;width:100%;clear:both;font-size:88%;text-align:center;padding:1px;margin:1em auto 0}.mw-parser-output .navbox .navbox{margin-top:0}.mw-parser-output .navbox+.navbox,.mw-parser-output .navbox+.navbox-styles+.navbox{margin-top:-1px}.mw-parser-output .navbox-inner,.mw-parser-output .navbox-subgroup{width:100%}.mw-parser-output .navbox-group,.mw-parser-output .navbox-title,.mw-parser-output .navbox-abovebelow{padding:0.25em 1em;line-height:1.5em;text-align:center}.mw-parser-output .navbox-group{white-space:nowrap;text-align:right}.mw-parser-output .navbox,.mw-parser-output .navbox-subgroup{background-color:#fdfdfd}.mw-parser-output .navbox-list{line-height:1.5em;border-color:#fdfdfd}.mw-parser-output .navbox-list-with-group{text-align:left;border-left-width:2px;border-left-style:solid}.mw-parser-output tr+tr>.navbox-abovebelow,.mw-parser-output tr+tr>.navbox-group,.mw-parser-output tr+tr>.navbox-image,.mw-parser-output tr+tr>.navbox-list{border-top:2px solid #fdfdfd}.mw-parser-output .navbox-title{background-color:#ccf}.mw-parser-output .navbox-abovebelow,.mw-parser-output .navbox-group,.mw-parser-output .navbox-subgroup .navbox-title{background-color:#ddf}.mw-parser-output .navbox-subgroup .navbox-group,.mw-parser-output .navbox-subgroup .navbox-abovebelow{background-color:#e6e6ff}.mw-parser-output .navbox-even{background-color:#f7f7f7}.mw-parser-output .navbox-odd{background-color:transparent}.mw-parser-output .navbox .hlist td dl,.mw-parser-output .navbox .hlist td ol,.mw-parser-output .navbox .hlist td ul,.mw-parser-output .navbox td.hlist dl,.mw-parser-output .navbox td.hlist ol,.mw-parser-output .navbox td.hlist ul{padding:0.125em 0}.mw-parser-output .navbox .navbar{display:block;font-size:100%}.mw-parser-output .navbox-title .navbar{float:left;text-align:left;margin-right:0.5em}body.skin--responsive .mw-parser-output .navbox-image img{max-width:none!important}@media print{body.ns-0 .mw-parser-output .navbox{display:none!important}}


/* end https://en.wikipedia.org/ */
</style></div><div role="navigation" class="navbox" aria-labelledby="Memory_management1048" style="padding:3px"><table class="nowraplinks hlist mw-collapsible autocollapse navbox-inner" style="border-spacing:0;background:transparent;color:inherit"><tbody><tr><th scope="col" class="navbox-title" colspan="2"><style data-mw-deduplicate="TemplateStyles:r1239400231">
/* start https://en.wikipedia.org/ */


.mw-parser-output .navbar{display:inline;font-size:88%;font-weight:normal}.mw-parser-output .navbar-collapse{float:left;text-align:left}.mw-parser-output .navbar-boxtext{word-spacing:0}.mw-parser-output .navbar ul{display:inline-block;white-space:nowrap;line-height:inherit}.mw-parser-output .navbar-brackets::before{margin-right:-0.125em;content:"[ "}.mw-parser-output .navbar-brackets::after{margin-left:-0.125em;content:" ]"}.mw-parser-output .navbar li{word-spacing:-0.125em}.mw-parser-output .navbar a>span,.mw-parser-output .navbar a>abbr{text-decoration:inherit}.mw-parser-output .navbar-mini abbr{font-variant:small-caps;border-bottom:none;text-decoration:none;cursor:inherit}.mw-parser-output .navbar-ct-full{font-size:114%;margin:0 7em}.mw-parser-output .navbar-ct-mini{font-size:114%;margin:0 4em}html.skin-theme-clientpref-night .mw-parser-output .navbar li a abbr{color:var(--color-base)!important}@media(prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .navbar li a abbr{color:var(--color-base)!important}}@media print{.mw-parser-output .navbar{display:none!important}}


/* end https://en.wikipedia.org/ */
</style><div id="Memory_management1048" style="font-size:114%;margin:0 4em"><a href="Memory_management" title="Memory management">Memory management</a></div></th></tr><tr><td class="navbox-abovebelow" colspan="2"><div>
<ul><li><a href="Memory_management_(operating_systems)" title="Memory management (operating systems)">Memory management as a function of an operating system</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Hardware</th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Memory_management_unit" title="Memory management unit">Memory management unit</a> (MMU)</li>
<li><a href="Translation_lookaside_buffer" title="Translation lookaside buffer">Translation lookaside buffer</a> (TLB)</li>
<li><a href="Input%E2%80%93output_memory_management_unit" title="Input–output memory management unit">Input–output memory management unit</a> (IOMMU)</li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="Virtual_memory" title="Virtual memory">Virtual memory</a></th><td class="navbox-list-with-group navbox-list navbox-even" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Demand_paging" title="Demand paging">Demand paging</a></li>
<li><a href="Memory_paging" title="Memory paging">Memory paging</a></li>
<li><a href="Page_table" title="Page table">Page table</a></li>
<li><a href="Virtual_memory_compression" title="Virtual memory compression">Virtual memory compression</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="Memory_segmentation" title="Memory segmentation">Segmentation</a></th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Protected_mode" title="Protected mode">Protected mode</a></li>
<li><a href="Real_mode" title="Real mode">Real mode</a></li>
<li><a href="Virtual_8086_mode" title="Virtual 8086 mode">Virtual 8086 mode</a></li>
<li><a href="X86_memory_segmentation" title="X86 memory segmentation">x86 memory segmentation</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="Memory_allocator" class="mw-redirect" title="Memory allocator">Allocator</a></th><td class="navbox-list-with-group navbox-list navbox-even" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Dlmalloc" class="mw-redirect" title="Dlmalloc">dlmalloc</a></li>
<li><a href="Hoard_memory_allocator" title="Hoard memory allocator">Hoard</a></li>
<li><a href="Jemalloc" class="mw-redirect" title="Jemalloc">jemalloc</a></li>
<li><a href="Libumem" title="Libumem">libumem</a></li>
<li><a href="Mimalloc" title="Mimalloc">mimalloc</a></li>
<li><a href="Ptmalloc" class="mw-redirect" title="Ptmalloc">ptmalloc</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="Manual_memory_management" title="Manual memory management">Manual</a> means</th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Static_variable" title="Static variable">Static memory allocation</a></li>
<li><a href="C_dynamic_memory_allocation" title="C dynamic memory allocation">C dynamic memory allocation</a></li>
<li><a href="New_and_delete_(C%2B%2B)" title="New and delete (C++)">new and delete (C++)</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="Garbage_collection_(computer_science)" title="Garbage collection (computer science)">Garbage<br>collection</a></th><td class="navbox-list-with-group navbox-list navbox-even" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Automatic_Reference_Counting" title="Automatic Reference Counting">Automatic Reference Counting</a></li>
<li><a href="Boehm_garbage_collector" title="Boehm garbage collector">Boehm garbage collector</a></li>
<li><a href="Cheney's_algorithm" title="Cheney's algorithm">Cheney's algorithm</a></li>
<li><a href="Concurrent_mark_sweep_collector" title="Concurrent mark sweep collector">Concurrent mark sweep collector</a></li>
<li><a href="Finalizer" title="Finalizer">Finalizer</a></li>
<li><a href="Garbage_(computer_science)" title="Garbage (computer science)">Garbage</a></li>
<li><a href="Garbage-first_collector" title="Garbage-first collector">Garbage-first collector</a></li>
<li><a href="Mark%E2%80%93compact_algorithm" title="Mark–compact algorithm">Mark–compact algorithm</a></li>
<li><a href="Reference_counting" title="Reference counting">Reference counting</a></li>
<li><a href="Tracing_garbage_collection" title="Tracing garbage collection">Tracing garbage collection</a></li>
<li><a href="Weak_reference" title="Weak reference">Strong reference</a></li>
<li><a href="Weak_reference" title="Weak reference">Weak reference</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="Memory_safety" title="Memory safety">Safety</a></th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Buffer_overflow" title="Buffer overflow">Buffer overflow</a></li>
<li><a href="Buffer_over-read" title="Buffer over-read">Buffer over-read</a></li>
<li><a href="Dangling_pointer" title="Dangling pointer">Dangling pointer</a></li>
<li><a href="Stack_overflow" title="Stack overflow">Stack overflow</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Issues</th><td class="navbox-list-with-group navbox-list navbox-even" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Fragmentation_(computing)" title="Fragmentation (computing)">Fragmentation</a></li>
<li><a href="Memory_leak" title="Memory leak">Memory leak</a></li>
<li><a href="Unreachable_memory" title="Unreachable memory">Unreachable memory</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Other</th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul>
<li><a href="International_Symposium_on_Memory_Management" title="International Symposium on Memory Management">International Symposium on Memory Management</a></li>
<li><a href="Region-based_memory_management" title="Region-based memory management">Region-based memory management</a></li>
<li><a href="Memory_pool" title="Memory pool">Memory pool</a></li></ul>
</div></td></tr><tr><td class="navbox-abovebelow" colspan="2"><div>
<ul><li><span class="noviewer" typeof="mw:File"><span title="Category"></span></span> Memory management</li>
<li><span class="noviewer" typeof="mw:File"><span title="Category"></span></span> Virtual memory</li>
<li><span class="noviewer" typeof="mw:File"><span title="Category"></span></span> Automatic memory management</li>
<li><span class="noviewer" typeof="mw:File"><span title="Category"></span></span> Memory management algorithms</li>
<li><span class="noviewer" typeof="mw:File"><span title="Category"></span></span> Memory management software</li></ul>
</div></td></tr></tbody></table></div></div><!--htdig_noindex--><div><div class="zim-footer">
This article is issued from <a class="external text" title="Last edited on 2025-07-18" href="https://en.wikipedia.org/wiki/?title=Automatic_variable&amp;oldid=1301224858">Wikipedia</a>. The text is available under <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">Creative Commons Attribution-Share Alike 4.0</a> unless otherwise noted. Additional terms may apply for the media files.
</div>
</div><!--/htdig_noindex--></div>
</div>
</main>
</div>
</div>
</div>

</body></html>